﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using LJLNet.SocketTCPPeer;

namespace LJLNet.Application
{
    /// <summary>
    /// 该类是主类  框架主入口（如果需要修改主入口函数 需要在Program类中修改）
    /// </summary>
    public class GameContext : Application
    {
        /// <summary>
        /// 客户端接入函数
        /// </summary>
        /// <param name="socket"></param>
        /// <returns></returns>
        public BasePeer CreatePeer(Socket socket)
        {
            BasePeer peer = new ClientPeer(socket);
            ServerMgr.GetInstance.peerList.Add(peer); 

            return peer;
        }



        /// <summary>
        /// 框架启动函数
        /// </summary>
        public void Setup()
        {
            Console.WriteLine("启动框架");        
        }



        /// <summary>
        /// 框架取消函数
        /// </summary>
        public void TearDown()
        {
            Console.WriteLine("停止框架");
        }
    }
}
